#include <stdio.h>
int main()
{
    __int64 d[21],i,n;
    d[1]=0;d[2]=1;
    for (i=3;i<=20;i++)d[i]=(i-1)*(d[i-1]+d[i-2]);
    while (scanf("%I64d",&n)!=EOF)
    {
        printf("%I64d\n",d[n]);
    }
    return 0;
}
